import React, { PureComponent, Suspense } from 'react';
import { connect } from 'dva/index';
import { Card, Col, message, Radio, Row, Select } from 'antd/lib/index';

import Donut from '@/pages/PositionSystem/PositionStatistics/Donut';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';

@connect(({ fund, loading }) => ({
  fund,
  loading: loading.models.ruleTest,
}))
class IndustryPer extends PureComponent {
  state = {};

  data = [
    {
      item: '事例一',
      count: 10,
    },
    {
      item: '事例二',
      count: 10,
    },
    {
      item: '事例三',
      count: 10,
    },
    {
      item: '事例四',
      count: 10,
    },
    {
      item: '事例五',
      count: 10,
    },
    {
      item: '事例6',
      count: 10,
    },
    {
      item: '事例7',
      count: 10,
    },
    {
      item: '事例8',
      count: 10,
    },
    {
      item: '事例9',
      count: 10,
    },
    {
      item: '事例10',
      count: 2,
    },
    {
      item: '事例11',
      count: 2,
    },
  ];

  donutClick(value) {
    alert(value);
  }

  render() {
    const {
      fund: { industryPerdata },
    } = this.props;

    return (
      <PageHeaderWrapper title="行业占比">
        <Card bordered={false}>
          {industryPerdata.list.items.length === 0 ? (
            <div />
          ) : (
            <div>
              {
                <Donut
                  data={industryPerdata.list.items}
                  // data={this.data}

                  title={industryPerdata.list.title}
                  date={industryPerdata.list.date}
                />
              }
            </div>
          )}
        </Card>
      </PageHeaderWrapper>
    );
  }

  // 加载完 之后 再加载 此 方法
  componentDidMount() {
    const { dispatch } = this.props;
    // const {param,param1} = this.state;
    dispatch({
      type: 'fund/GetIndustryPer',
      payload: {},
    });
  }
}

export default IndustryPer;
